import requests from './request.js';

// 查询(其他人的)博客列表
export const getBlogListByUserAid = (aid) => requests({
    url: `/blog/getBlogListByUserAid?userAid=${aid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 查询(自己的)博客列表
export const getBlogListApi = (params) => requests({
    url: '/blog/getMyselfBlogList',
    method: 'get',
    params: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 根据博客aid后端获取博客相关的所有信息
export const getBlogAllInfoByAid = (blogAid) => requests({
    url: `/blog/getBlogAllInfoByAid?blogAid=${blogAid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 当前登陆用户收藏这条博客
export const currentUserCollectCurrentBlog = (blogAid) => requests({
    url: `/blog/currentUserCollectCurrentBlog?blogAid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 当前登陆用户取消收藏这条博客
export const userCancelCollectBlog = (blogAid) => requests({
    url: `/blog/userCancelCollectBlog?blogAid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 给这个博客点赞
export const thumbsUpToblog = (blogAid) => requests({
    url: `/blog/dianzanBlog?aid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 博客取消点赞
export const cancelThumbsUpToblog = (blogAid) => requests({
    url: `/blog/cancelDianzanBlog?aid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 关注这个博客的作者
export const guanzhuBlogAuthor = (blogAid) => requests({
    url: `/blog/guanzhuBlogAuthor?blogAid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 取消关注这个博客的作者
export const cancelGuanzhuBlogAuthor = (blogAid) => requests({
    url: `/blog/cancelGuanzhuBlogAuthor?blogAid=${blogAid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 点击评论里面的赞，改变赞的状态
export const clickCommentLike = (aid) => requests({
    url: `/blog/clickCommentLike?aid=${aid}`,
    method: 'post',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 发表评论
export const blogCommentPublish = (params) => requests({
    url: `/blog/blogCommentPublish`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 在编辑博客的页面点击删除图标删除图片
export const deleteImage = (params) => requests({
    url: `/alioss/deleteBlogImgByOss`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 添加或者编辑博客
export const addOrEditBlog = (params) => requests({
    url: `/blog/addOrEditBlog`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 获取系统给当前登陆的用户推荐的所有博客列表
export const getRecommentBlogList = () => requests({
    url: `/blog/getRecommentBlogList`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 获取当前登陆这个用户关注的所有用户的所有博客列表
export const getCurrentUserConcernUserBlogList = (page,pageSize) => requests({
    url: `/blog/getCurrentUserConcernUserBlogList?page=${page}&pageSize=${pageSize}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});